const CompressionPlugin = require('compression-webpack-plugin');

module.exports = {
    devServer: {
        host: '0.0.0.0',
        port: 8081,
        proxy: {
            '/zwz': {
                // target: 'http://47.109.43.10:8111',
                // target: 'http://api.hongys.xyz:8111',
                target: 'http://127.0.0.1:8111',
                ws: true,
                changeOrigin: true
            }
        }
    },
    productionSourceMap: false,
    configureWebpack: {
        plugins: [
            new CompressionPlugin({
                test: /\.js$|\.html$|\.css/,
                threshold: 10240
            })
        ],
        performance: {
            hints: false
        }
    },
    chainWebpack: config => {
        config.module
            .rule('fonts')
            .use('url-loader')
            .loader('url-loader')
            .tap(options => {
                options = {
                    limit: 10000,
                    fallback: {
                        loader: 'file-loader',
                        options: {
                            name: 'fonts/[name].[hash:8].[ext]'
                        }
                    }
                }
                return options
            })
    }
}